package org.samoji.sji.model;
import java.math.BigDecimal;
import java.math.MathContext;

import org.samoji.sji.profTokenizer.Token.Type;

public class PlusBinExpr extends BinExpr {
	protected PlusBinExpr(Expr left, Expr right) {
		super(Type.Plus, left, right);
	}
	
	@Override
	public BigDecimal evaluate(Env env) {
		return left.evaluate(env).add(right.evaluate(env), MathContext.DECIMAL128);
	}
	
	public static PlusBinExpr _(Expr left, Expr right) {
		return new PlusBinExpr(left, right);
	}
}
